#include <iostream>
#include <fstream>
namespace testSpace
{
	typedef struct point
	{
		int x;
		int y;
	} points;

	template <typename T>
	class myStack
	{
	private:
		int size;
		int capacity;
		T *data;
		
		void morecapacity()
		{
			int newcapacity = capacity * 2;
			T *newData = new T[newcapacity];
			for (int i = 0; i < size; i++)
			{
				newData[i] = data[i];
			}
			delete[] data;
			data = newData;
			capacity = newcapacity;
		}

	public:
		myStack(int a) : size(0), capacity(a), data(new T[this->capacity]) {}

		~myStack()
		{
			delete[] data;
		}

		void myPush(T a)
		{
			if (size == capacity)
				morecapacity();
			data[size] = a;
			size++;
		}

		void myPop()
		{
			if (size == 0)
			{
				std::cout << "空栈！" << std::endl;
				return;
			}
			size -= 1;
			return;
		}

		auto myStack<T>::myTop() const
		{
			if (size == 0)
			{
				std::cout << "空栈！" << std::endl;
				return data[size];
			}
			return data[size - 1];
		}

		int getSize() const
		{
			return size;
		}

		bool isEmpty()
		{
			return size == 0;
		}
	};

	
}